<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>无标题文档</title>
<style>
body{height:2500px; padding:0; margin:0;}
#div1{height:30px; width:100%; background:#0AF;}
#div2{height:30px; width:100%; background:red; top:400px; position:absolute;}
</style>
<script type="text/javascript">
	window.onscroll = function(){
		var div2 = document.getElementById("div2");
		var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
		
		if(scrollTop >= 400){
			div2.style.position = "fixed";
			div2.style.top = 0;
		} else {
			div2.style.position = "absolute";
			div2.style.top = "400px";
		}
	}
</script>
</head>

<body>
<div id="div1">
	顶部信息栏
</div>
<div id="div2">
	留言信息
</div>
</body>
</html>
